package com.company;


import org.apache.commons.codec.digest.DigestUtils;

import java.util.Base64;


public class SignUtils {

    /**
     * Base64
     */
    private static String base64(String str) {
        byte[] bytes = str.getBytes();
        return Base64.getEncoder().encodeToString(bytes);
    }

    public static String getSign(String password, String... params) {
        StringBuffer sb = new StringBuffer(password);
        if (params != null) {
            for (String o : params) {
                sb.append(o);
            }
        }
        String mysign = base64(DigestUtils.md5Hex(DigestUtils.md5Hex(sb.toString())));
        return mysign;
    }
}
